package com.sjtu.vfact.textual.model;

import java.util.ArrayList;
import java.util.List;

public class Cluster<V> {
	private V prototype;
	private List<V> childs;
	
	public Cluster(V prototype, List<V> childs){
		this.prototype = prototype;
		this.childs = childs;
	}

	public V getPrototype() {
		return prototype;
	}

	public void setPrototype(V prototype) {
		this.prototype = prototype;
	}

	public List<V> getChilds() {
		return childs;
	}

	public void setChilds(List<V> childs) {
		this.childs = childs;
	}
	
	public int getSize(){
		return childs.size() + 1; //plus 1 because of prototype
	}
	
	public List<V> getAllVertices(){
		List<V> list = new ArrayList<V>(childs);
		list.add(prototype);
		return list;
	}
	
	@Override
	public String toString() {
		String res = "Prototype : " + prototype.toString() + "\n\tChilds : ";
		for(V ts : childs){
			res += ts.toString() + "\n\t         ";
		}
		return res;
	}
	
}
